package com.love.poetry.infrastructure.persist.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.love.poetry.domain.KeywordTag;
import com.love.poetry.infrastructure.persist.KeywordTagRepostory;
import com.youboy.core.orm.mybatis.MybatisRepositorySupport;

@Repository
public class MybatisKeywordTagRepostory extends MybatisRepositorySupport<String, KeywordTag> implements KeywordTagRepostory {

	@Override
	protected String getNamespace() {
		return "com.love.poetry.domain.KeywordTag";
	}

	public void delete(String id) {
		 getSqlSession().delete(getNamespace() + ".delete", id);
	}

	public KeywordTag queryUniqueByPath(String path) {
		return (KeywordTag) getSqlSession().selectOne(getNamespace() + ".queryUniqueByPath", path);
	}

	public KeywordTag queryUniqueByName(String name) {
		return (KeywordTag) getSqlSession().selectOne(getNamespace() + ".queryUniqueByName", name);
	}

	@SuppressWarnings("unchecked")
	public List<KeywordTag> queryTop() {
		return getSqlSession().selectList(getNamespace() + ".queryTop");
	}

}